package com.varian.system.remote;

import com.varian.system.dto.UserDetailDTO;
import com.varian.tool.contant.VarianConstant;
import com.varian.tool.result.R;
import jakarta.validation.constraints.NotBlank;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ben
 * @since 2024/7/1
 */
@FeignClient(
        value = VarianConstant.VARIAN_SYSTEM,
        fallback = SysUserFallback.class,
        path = VarianConstant.FEIGN_PREFIX_PATH,
        contextId = "sysUserRemote"
)
public interface SysUserRemote {

    String GET_USER_BY_USERNAME = "user/get-by-username";

    /**
     * 根据用户名获取用户信息
     *
     * @param username 用户名
     * @return 用户信息
     */
    @Validated
    @GetMapping(GET_USER_BY_USERNAME)
    R<UserDetailDTO> getUserByUsername(@NotBlank(message = "用户名不能为空") @RequestParam("username") String username);
}
